home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ShareWare OnLine 2
/
ShareWare OnLine Volume 2 (CMS Software)(1993).iso
/
clipart
/
vpoint.zip
/
AJGFUN.H
next >
Wrap
C/C++ Source or Header
|
1993-01-23
|
5KB
|
195 lines
/* --------------------------------------------------------------------------
AJGFUN.H -- (AJ's graphics functions header file)
Function prototypes and typedefs for GRAPHICS program utilities
Written by Arthur Dunphy Jr. Spring 1992 in Microsoft QuickC v2.51
Portions copyright Microsoft Corp.
--------------------------------------------------------------------------- */
#ifndef NUMFUN_DEFINED
#define NUMFUN_DEFINED
typedef unsigned long color_t; /// color values for palette remapping
/* Macro for setting a VGA color, each element has range 0 through 63 */
#define rgb( r, g, b ) \
(((( (color_t)(b) ) << 16 ) \
| ( (color_t)(g) ) << 8 \
| ( (color_t)(r) )) & 0x3F3F3FL )
struct color_struct
{
color_t r, g, b;
};
typedef struct color_struct color_s;
/* Macro same as above but takes color_struct as argument */
#define rgb2( color ) \
(((( (color_s)(color.b) ) << 16 ) \
| ( (color_s)(color.g) ) << 8 \
| ( (color_s)(color.r) )) & 0x3F3F3FL )
/* Another Macro for mixing Red, Green, and Blue elements of color */
#define RGB(r,g,b) (((color_t) ((b) << 8 | (g)) << 8) | (r))
typedef int mouse_t; /// for variables involved in mouse functions
typedef unsigned long key_t; /// for storing key-press ascii codes
/* The following are just some descriptive names to make branching and
looping statements more readable */
#define TRUE 1
#define FALSE 0
#define ON 1
#define OFF 0
#define YES 1
#define NO 0
#define GOOD 1
#define BAD 0
#define BEGIN 1
#define END 0
#define GO 1
#define NOGO 0
#define EQ ==
#define NE !=
#define UNABLETO !
#define CANT !
#define NOT !
#define THEN
#define AND &&
#define OR ||
#define BINARY 2
#define DECIMAL 10
#define HEX 16
/* Constants for brush patterns for cad?.c */
#define DOT 1
#define SLASH 2
#define BACKSLASH 3
#define SPRAY 4
#define CUSTOMIZED 8
typedef signed char boolean;
typedef short pixtype; /// logical pixel coordinate type
struct pos_struct
/// Structure to define variables needed for drawing squares
{
pixtype xpos; /// x and y logical coordinates
pixtype ypos;
pixtype width; /// Width and height of each square
pixtype height;
int num; /// Character to be drawn inside square
boolean used; /// Flag for if a number has been picked already
} ;
struct pos_struct posarray[4][10];
/// Dimensions of grid of squares to be drawn
struct rect_struct /// defines logical coordinates of a rectangle
{
pixtype x1;
pixtype y1;
pixtype x2;
pixtype y2;
} ;
typedef struct rect_struct rect_s;
struct videoconfig vc; /// video configuration variables, eg. # of pages available
struct _fontinfo fi; /// font information variables, eg. width of character.
/// Constants for the following function
#define NOFILL 0
#define FILL 1
/* Basically the same as QuickC _rectangle(), but takes a rect_struct as the
argument. This is easier to program when drawing large numbers of
rectangles which must be updated, or changed somehow, frequently. */
void drawrect(boolean fill, rect_s * rect);
/* Sets the logical x-y coordinates in graphics modes to the center of the
screen, eg 640 * 380 mode will _setlogorg() to ( 319, 179 ). */
void set_center_origin(void);
void getdate(char * datestr, time_t days);
boolean set_font(short font, short size);
void int_to_s(short nums[7], char list[20]);
void remap(short x1, short x2, short y1, short y2);
void remap2(short x1, short y1, short x2, short y2, short maptype);
enum FONTS { COUR = 1, HELV, TRMN, MOD, SCRP, ROM , HELVE, HELVF, TRMNE, \
TRMNF, VGAFIX, VGAOEM, VGASYS};
typedef enum FONTS fonts;
#define PURPLE 0x331436
#define LT_GREEN 0x213907
#define LT_BLUE 0x3D2407
#define OFF_RED 0x1E0038
/*unsigned long color_array[16] =
{_BLACK, _BLUE, _GREEN, _CYAN, _RED, _GRAY,
LT_BLUE, _WHITE, OFF_RED, PURPLE, _LIGHTGREEN,
_LIGHTCYAN, _LIGHTRED, _LIGHTMAGENTA, LT_GREEN,
_BRIGHTWHITE}; */
#define $BLACK 0
#define $BLUE 1
#define $GREEN 2
#define $CYAN 3
#define $RED 4
#define $GRAY 5
#define $LT_BLUE 6
#define $WHITE 7
#define $OFF_RED 8
#define $PURPLE 9
#define $LT_GREEN 10
#define $LT_CYAN 11
#define $LT_RED 12
#define $LT_MAG 13
#define $LIGHTG 14
#define $BR_WHITE 15
void cycle(short n, short type, short r, short g, short b) ;
void sort(int * x, int n);
/* Accepts a character string and returns, depending on the video mode and
the current character font, the logical x coordinate to center the string
in the middle of the screen */
pixtype centerx(char * s);
void mixall(void);
boolean regfonts(void); /// Expanded version of _registerfonts() function from
/// QuickC. Provides more error checking. Returns 0 if
/// font files cannot be located, TRUE otherwise.
unsigned long get_color(int *type, int *r, int *g, int *b);
boolean reset_mouse( void );
#endif